Repository navigation
UCI: go nodes, full node counts and FEN validation - #65
Merged
Merged
Conversation
"go nodes N" stops the search once main plus quiescence nodes reach N. The limit lives in DepthCondition as a NodeBudget shared by all search threads, counted through a CountsNodes hook that compiles to nothing for the other exit conditions. With one thread a fresh engine process gives the same best move and node count for the same command; the info lines report the nodes of the last completed iteration. The clock-controlled search used in games adds no instruction, call or store: the TimeCondition search nodes differ from the base only in stack slot assignment, and the Pondering ones gain only the budget compare in their DepthCondition branch. Fixed-depth search stays node-for-node identical on 30 positions at depth 11 and costs 0.07% more instructions per node for the counter check. Bench: 2709383 Co-Authored-By: Claude Opus 5.5 <[email protected]>
"info nodes" now counts main plus quiescence nodes, the same total that "nps" is computed from. The separate "info quiescence_nodes" line is gone; no tool or test reads it. Search is unchanged: the same 30 positions at depth 11 give the same best moves, and each new node count equals the old main plus quiescence count. Bench: 2709383 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test waited 15 seconds for "uciok". An idle start takes about a second, but on a loaded machine a cold start once took 34 seconds. The wait is now 60 seconds. The other two tests that were excluded locally do not need changes: SharedClusterTable.ConcurrentEntriesStayConsistent passed every run in a few milliseconds, and BestMove.WinAtChess is a strength test with a wall-clock budget per position, so it stays excluded as in CI. Bench: 2709383 Co-Authored-By: Claude Opus 5.5 <[email protected]>
"position fen" used to read any string into a Position: a garbage board, a pawn on the back rank, two kings, a castling right without its rook or an en passant square without a pushed pawn all produced a corrupt position for the search. PositionFactory::TryParse now parses the FEN once and returns std::nullopt for anything the engine cannot represent, and the UCI handler also refuses positions where the side to move could capture the king. A rejected FEN is reported with "info string invalid fen" and keeps the previous position. Before the first "position" command the engine now holds the initial position instead of an empty board. Shredder-FEN castling files (A-H, a-h) are accepted and ignored, as before. Valid FENs give the same Position as before: perft and the fixed-depth search checks are unchanged. Bench: 2709383 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A fixed-seed batch of mutated FENs, illegal or truncated moves and garbage go and setoption arguments runs through one engine process and checks that the engine neither crashes nor changes its position. It takes about ten seconds in Release and also passes under AddressSanitizer and UndefinedBehaviorSanitizer. Bench: 2709383 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 9, 2026
Bench: 696698
Bench: 696698 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bench: 696698 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restore compiler-selected inlining for the time condition while retaining the typed node-budget search. Bench: 993713
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #63 (it uses the typed
ParseLegalMovefrom there); merge #63 first, then retarget this PR todeploy-eloif GitHub does not do it automatically.What changes
go nodes Nstops the search once main plus quiescence nodes reach N, shared across threads. With one thread a fresh engine gives the same best move and node count every time.info nodesnow counts main plus quiescence nodes, the same totalnpsuses. The non-standardinfo quiescence_nodesline is gone.FEN validation:
PositionFactory::TryParseparses a FEN once and returnsstd::nulloptfor a malformed or unrepresentable position:The UCI handler also rejects positions where the side to move can capture the king. A rejected FEN prints
info string invalid fen …and keeps the previous position. Before the firstpositioncommand the engine now holds the initial position, not an empty board. Shredder-FEN castling files are still ignored, as before.Tests:
go/setoptioninput, which also passes under ASan/UBSan;uciokwait in the Lazy SMP test, which once needed 34 s to start on a loaded machine.Proof that search is unchanged
Asm vs Track move legality in the type system #63 (LTO gate build):
SearchNode<TimeCondition>(used in games): only stack slots are reassigned.Ponderingnodes: gain only the node-budget compare in theirDepthConditionbranch, with the same calls and stores.DoMoveand NNUEEvaluate: inlining and register reshuffles from the larger program. Perf below shows no cost.Search identity: 30 positions at depth 11 give the same best moves and the same 7,274,560 nodes as Track move legality in the type system #63.
Perf (CPU 19, alternating):
Perft: unchanged, startpos d5 4,865,609 and kiwipete d4 4,085,603.
Bench: with Track move legality in the type system #63 and Search bench signature, stronger CI and debug self-checks #64 merged,
benchstill givesBench: 2709383, so all commits carry that line.Tests: all 206 ctest tests pass. That includes
SharedClusterTable.ConcurrentEntriesStayConsistentand the Lazy SMP lifecycle test, which used to be excluded locally.BestMove.WinAtChessstays excluded, as in CI: it is a strength test with a wall-clock budget.🤖 Generated with Claude Code